package red.lsk.business.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import red.lsk.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import red.lsk.business.mapper.BizRechargeRecordsMapper;
import red.lsk.business.domain.BizRechargeRecords;
import red.lsk.business.service.IBizRechargeRecordsService;
import red.lsk.common.core.text.Convert;

/**
 * 充值记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-09
 */
@Service
public class BizRechargeRecordsServiceImpl implements IBizRechargeRecordsService 
{
    @Autowired
    private BizRechargeRecordsMapper bizRechargeRecordsMapper;

    /**
     * 查询充值记录
     * 
     * @param id 充值记录主键
     * @return 充值记录
     */
    @Override
    public BizRechargeRecords selectBizRechargeRecordsById(String id)
    {
        return bizRechargeRecordsMapper.selectBizRechargeRecordsById(id);
    }

    /**
     * 查询充值记录列表
     * 
     * @param bizRechargeRecords 充值记录
     * @return 充值记录
     */
    @Override
    public List<BizRechargeRecords> selectBizRechargeRecordsList(BizRechargeRecords bizRechargeRecords)
    {
        return bizRechargeRecordsMapper.selectBizRechargeRecordsList(bizRechargeRecords);
    }

    /**
     * 新增充值记录
     * 
     * @param bizRechargeRecords 充值记录
     * @return 结果
     */
    @Override
    public int insertBizRechargeRecords(BizRechargeRecords bizRechargeRecords)
    {
        String idStr = IdUtil.getSnowflake(1, 1).nextIdStr();
        bizRechargeRecords.setId(idStr);
        bizRechargeRecords.setCreateTime(DateUtils.getNowDate());
        return bizRechargeRecordsMapper.insertBizRechargeRecords(bizRechargeRecords);
    }

    /**
     * 修改充值记录
     * 
     * @param bizRechargeRecords 充值记录
     * @return 结果
     */
    @Override
    public int updateBizRechargeRecords(BizRechargeRecords bizRechargeRecords)
    {
        bizRechargeRecords.setUpdateTime(DateUtils.getNowDate());
        return bizRechargeRecordsMapper.updateBizRechargeRecords(bizRechargeRecords);
    }

    /**
     * 批量删除充值记录
     * 
     * @param ids 需要删除的充值记录主键
     * @return 结果
     */
    @Override
    public int deleteBizRechargeRecordsByIds(String ids)
    {
        return bizRechargeRecordsMapper.deleteBizRechargeRecordsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除充值记录信息
     * 
     * @param id 充值记录主键
     * @return 结果
     */
    @Override
    public int deleteBizRechargeRecordsById(String id)
    {
        return bizRechargeRecordsMapper.deleteBizRechargeRecordsById(id);
    }
}
